package com.pronosticnews.server.services;

import java.util.Comparator;

import com.pronosticnews.server.domain.model.Participation;

public class CompareClassementByDifferenceBut implements
		Comparator<Participation> {

	@Override
	public int compare(Participation cl1, Participation cl2) {
		try {
			if (!cl1.getPoints().equals(cl2.getPoints())) {
				return 0;
			} else {
				return cl1.getDifferenceButs().compareTo(
						cl2.getDifferenceButs());
			}
		} catch (NullPointerException n) {
			return 0;
		}
	}

}
